import { defineStore } from 'pinia'
import { ref } from 'vue'

// 用户模块
export const useUserStore = defineStore(
  'car-user',
  () => {
    // 用户信息
    const user = ref({})
    const setUser = (newUser) => {
      user.value = newUser
    }

    // token
    const token = ref('')
    const setToken = (newToken) => {
      token.value = newToken
    }

    return {
      user,
      setUser,
      token,
      setToken
    }
  },
  {
    persist: true
  }
)
